<?php
/**
 * Created by PhpStorm.
 * User: yangyou
 * Date: 2019/1/7 0007
 * Time: 10:17
 */

namespace app\index\model;


class Browserecord extends Base
{
    /**
     * Author:yang you
     * Time:2018-12-2 10:27:51
     * Describe:资讯列表
     * @param string classification_id
     */
    public function newsList($classification_id = "",$after_limit = "10",$keyword = ""){
        return $this->where(function ($q)use ($classification_id){
            if(!empty($classification_id)){
                //查找该栏目资讯
                $q->where("classification_id",$classification_id);
            }
        })
            ->where(function ($q)use ($keyword){
                if(!empty($keyword)){
                    //模糊查找支持标题和编号
                    $q->whereOr("information_title",'like','%'.$keyword.'%')->whereOr("text_content",'like','%'.$keyword.'%');
                }
            })
            ->where('is_display',1)
            ->where('delete',0)
            ->orderRaw("update_time DESC")
            ->paginate($after_limit,false,[
                'type'     => 'page\marketPage',
                'var_page'  => 'p',
                'query' =>  request()->param(),
            ]);
    }

}